<template>
    <div class="newsDetail">
        <div class="mainDetail">
            <div class="titleDetail">
                <h2>
                    {{p.title}}
                </h2>
            </div>
             <div class="footer">
                <a-space :size='50'>
                    <span>作者：{{p.username}}</span>
                    <span>发布时间：{{format(p.UpdatedAt)}}</span>
                </a-space>
            </div>
            <div class="content">
                <p>
                    {{p.content}}
                </p>
            </div>
        </div>
    </div>
</template>
<script>
import './styles.less'
import newsAPI from "../../services/news";
import { requestWrapper } from "../../utils/request";
import format  from "../../utils/format";
export default {
    data() {
        return {
            newsList: [],
            format: format,
            id:'',
            p: {}
        }
    },
    mounted() {
      this.id = this.$route.query.newsId;
      requestWrapper( newsAPI.getNewsDetail.bind(null, this.id), {
      }).then((res) => {
          this.p = res
      })
    }
}
</script>
